package goomi.size;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;

import db.mysql.mySqlUtils;

public class sizeService {
	public static void main(String args[]) 
	{
		//test
		try{
//			sizeService size = new sizeService();
//			size.getSize();
		}catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}

	
	public ArrayList getSize(String id){
		Connection conn = null;
		try{
			conn = mySqlUtils.getConn();
			Statement st = conn.createStatement();
			ResultSet rs = st.executeQuery("select * from size_info");
			ArrayList tmp = new ArrayList();
			while(rs!= null && rs.next()){
				HashMap tmpMap = new HashMap();
				if(rs.getString("id")!= null)tmpMap.put("id", rs.getString("id"));
				if(rs.getString("id")!= null)tmpMap.put("db_id", rs.getString("id"));
				if(rs.getString("size")!= null)tmpMap.put("size", rs.getString("size"));
				if(rs.getString("fit_range_begin")!= null)tmpMap.put("fit_range_begin", rs.getString("fit_range_begin"));
				if(rs.getString("fit_range_end")!= null)tmpMap.put("fit_range_end", rs.getString("fit_range_end"));
				if(rs.getString("remark")!= null)tmpMap.put("remark", rs.getString("remark"));
				System.out.println("size while");
				tmp.add(tmpMap);
			}
			System.out.println("end size");
			rs.close();
			st.close();
			return tmp;
		}catch (Exception e) {
			e.printStackTrace();
		}finally{
			if(conn != null){
				try{
					conn.close();
				}catch (Exception e) {
					// TODO: handle exception
				}
			}
		}
		return null;
	}
}
